package com.xingfudazi.app.domain;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xingfudazi.common.annotation.Excel;
import lombok.Data;

import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Calendar;
import java.util.Date;

/**
 * 会员-个人信息对象 app_member_info
 * 
 * @author ruoyi
 * @date 2024-06-21
 */
@Data
public class AppMemberInfo
{
    private static final long serialVersionUID = 1L;

    /** $column.columnComment */
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    /** 关联mumber_id */
    @Excel(name = "关联mumber_id")
    private Long nid;

    /** 昵称 */
    @Excel(name = "昵称")
    private String nickName;

    /** 真实名字 */
    @Excel(name = "真实名字")
    private String relName;

    /** 性别 */
    @Excel(name = "性别")
    private String sex;

    /** 生日 */
    @Excel(name = "生日")
    private String birthday;

    /** 电话 */
    @Excel(name = "电话")
    private String phone;

    /** 邮箱 */
    @Excel(name = "邮箱")
    private String email;

    /** 省 */
    @Excel(name = "省")
    private String province;

    /** 市 */
    @Excel(name = "市")
    private String city;

    /** 区 */
    @Excel(name = "区")
    private String area;

    /** 身高 cm */
    @Excel(name = "身高 cm")
    private Integer height;

    /** 体重 kg */
    @Excel(name = "体重 kg")
    private Integer weight;

    /** 民族 */
    @Excel(name = "民族")
    private String nation;

    /** 星座 */
    @Excel(name = "星座")
    private String star;

    /** 生肖 */
    @Excel(name = "生肖")
    private String zodiac;

    /** 职业 */
    @Excel(name = "职业")
    private String career;

    /** 学历 */
    @Excel(name = "学历")
    private String education;

    /** 学校 */
    @Excel(name = "学校")
    private String school;

    /** 头像 */
    @Excel(name = "头像")
    private String avatar;

    /** 兴趣爱好 tab */
    @Excel(name = "兴趣爱好 tab")
    private String interest;

    /** 手型臂型，四种 LL,LR,RL,RR，没有设置为X */
    @Excel(name = "手型臂型，四种 LL,LR,RL,RR，没有设置为X")
    private String head;

    /** 血型，四种， A，B，O, AB，没有设置为X */
    @Excel(name = "血型，四种， A，B，O, AB，没有设置为X")
    private String blood;

    /** 四皆码 */
    @Excel(name = "四皆码")
    private String fourCode;

    /** 需求 */
    @Excel(name = "需求")
    private String need;

    /** 介绍 */
    @Excel(name = "介绍")
    private String introduce;

    /** 封面 */
    @Excel(name = "封面")
    private String cover;

    /** 会员码 */
    @Excel(name = "会员码")
    private String code;

    /** 介绍图 */
    @Excel(name = "介绍图")
    private String images;


    /** 删除标志 */
    @TableField(fill = FieldFill.INSERT,value = "del_flag")
    private String delFlag;


    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT,value = "create_time")
    private LocalDateTime createTime;


    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.UPDATE,value = "update_time")
    private LocalDateTime updateTime;


    public static String computeZodiac(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        int year = calendar.get(Calendar.YEAR);

        String[] zodiacs = { "鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪", };
        int zodiacIndex = (year - 1900) % 12;
        return zodiacs[zodiacIndex];
    }

    public static String computeConstellation(Date date) {
        Instant instant = date.toInstant();
        // 将 java.time.Instant 转换为 java.time.LocalDate
        LocalDate localDate = instant.atZone(ZoneId.systemDefault()).toLocalDate();
        int day = localDate.getDayOfMonth();
        switch (localDate.getMonth()) {
            case JANUARY:
                return (day < 20) ? "摩羯座" : "水瓶座";
            case FEBRUARY:
                return (day < 19) ? "水瓶座" : "双鱼座";
            case MARCH:
                return (day < 21) ? "双鱼座" : "白羊座";
            case APRIL:
                return (day < 20) ? "白羊座" : "金牛座";
            case MAY:
                return (day < 21) ? "金牛座" : "双子座";
            case JUNE:
                return (day < 22) ? "双子座" : "巨蟹座";
            case JULY:
                return (day < 23) ? "巨蟹座" : "狮子座";
            case AUGUST:
                return (day < 23) ? "狮子座" : "处女座";
            case SEPTEMBER:
                return (day < 23) ? "处女座" : "天秤座";
            case OCTOBER:
                return (day < 24) ? "天秤座" : "天蝎座";
            case NOVEMBER:
                return (day <= 22) ? "天蝎座" : "射手座";
            case DECEMBER:
                return (day < 22) ? "射手座" : "摩羯座";
            default:
                return "";
        }
    }


}
